package com.atzly.community.datasource.util;

import com.atzly.community.datasource.MyConfig;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import lombok.Data;

/**
 * 获取当前线程上下文环境配置
 */
@Data
public class ServiceContext {
    /**
     * 应用id
     * 暂时写死
     */
    private Long mainAppId = ((MyConfig)SpringContextUtil.getBean("myConfig")).getAppId();
    /**
     * 缺省
     */
    private String shardDbId;
    /**
     * 租户id
     */
//    private Long tenantId = AuthContext.getTenantId();
    /**
     * 数据源id
     */
    private String dbId;

    private String dsKey = DynamicDataSourceContextHolder.peek();
}
